//
//  MZDCSViewController.m
//  民族文化宫
//
//  Created by WANG CUNRUI on 14-6-4.
//  Copyright (c) 2014年 WANG CUNRUI. All rights reserved.
//

#import "MZDCSViewController.h"

@interface MZDCSViewController ()
{
    CGFloat s;
}
@end

@implementation MZDCSViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    CGRect frame = self.view.bounds;
    CGSize f = frame.size;
    CGFloat h = f.height;
    UIImageView *cameraImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"scan_bg.png"]];
    cameraImage.frame = CGRectMake(0,0,320,h);
    [self.view addSubview:cameraImage];
    UIImageView *lightImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"button_light_off.png"]];
    lightImage.frame = CGRectMake(130,0.74*h,60,60);
    [self.view addSubview:lightImage];
    _buttonlight = [UIButton buttonWithType:UIButtonTypeCustom];
    _buttonlight.frame = CGRectMake(130, 0.74*h, 60, 60);
    [_buttonlight setBackgroundColor:[UIColor clearColor]];
    [_buttonlight addTarget:self action:@selector(butClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_buttonlight];
    self.view.backgroundColor = [UIColor whiteColor];
    s = 0.74*h;
    // Do any additional setup after loading the view.
}

- (void)butClick:(id)sender
{

    if (isClick == NO) {
        UIImageView *lightImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"button_light_on.png"]];
        lightImage.frame = CGRectMake(130,s,60,60);
        [self.view addSubview:lightImage];
        isClick =YES;
    }else
    {
        UIImageView *lightImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"button_light_off.png"]];
        lightImage.frame = CGRectMake(130,s,60,60);
        [self.view addSubview:lightImage];
        isClick = NO;
        
    }
    
    
//    if (lightImage) {
//        lightImage.image = nil;
//    }
    //[self makeAlertView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
